package com.lantosec.hmrp.modules.cms.vo;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import com.lantosec.hmrp.modules.cms.entity.CmsArticle;
import com.lantosec.hmrp.core.mvc.BaseVO;
import com.lantosec.hmrp.modules.cms.entity.CmsAttachment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 * CMS文章列表 VO对象
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="CmsArticle对象", description="CMS文章列表")
public class CmsArticleVO extends BaseVO<CmsArticle> {
    private static final long serialVersionUID = 1L;


    public CmsArticleVO(CmsArticle entity){
        this.articleId = entity.getArticleId();
        this.categoryId = entity.getCategoryId();
        this.articleName = entity.getArticleName();
        this.contentBrief = entity.getContentBrief();
        this.content = entity.getContent();
        this.issuer = entity.getIssuer();
        this.upFlag = entity.getUpFlag();
        this.editorId = entity.getEditorId();
        this.editorName = entity.getEditorName();
        this.editorTime = entity.getEditorTime();
        this.thumbnail = entity.getThumbnail();
        this.articleFlag = entity.getArticleFlag();
        this.weight = entity.getWeight();
    }

    @Override
    public CmsArticle convertToEntity(){
        return new CmsArticle(this);
    }


    @ApiModelProperty(value = "文章ID")
    private Integer articleId;

    @ApiModelProperty(value = "栏目ID")
    private String categoryId;

    @ApiModelProperty(value = "文章名称")
    private String articleName;

    @ApiModelProperty(value = "内容简介")
    private String contentBrief;

    @ApiModelProperty(value = "内容")
    private String content;

    @ApiModelProperty(value = "发布者")
    private String issuer;

    @ApiModelProperty(value = "置顶标识")
    private Integer upFlag;

    @ApiModelProperty(value = "编辑者ID")
    private String editorId;

    @ApiModelProperty(value = "编辑者名称")
    private String editorName;

    @ApiModelProperty(value = "编辑时间")
    private Date editorTime;

    @ApiModelProperty(value = "缩略图")
    private String thumbnail;

    @ApiModelProperty(value = "文章标识(1头条2热门3推荐)")
    private Integer articleFlag;

    @ApiModelProperty(value = "权重(默认50)")
    private Integer weight;

    @ApiModelProperty(value = "栏目名称")
    private String categoryName;
    @ApiModelProperty(value = "缩略图路径")
    private String savePath;
    private List<CmsAttachmentVO> cmsAttachmentVOS;
}
